#ifndef ECAT_PDO_MAP_H
#define ECAT_PDO_MAP_H

#include "osal_defs.h"
#include <stdint.h>

/**
 * use __attribute((__packed__)) to ensure the bytes together
 */

#define IOMAP_SIZE 8192

using control_word_t            = uint16_t;
using operation_mode_t          = int8_t;
using target_position_t         = int32_t;
using touch_probe_function_t    = uint16_t;

using error_code_t              = uint16_t;
using status_word_t             = uint16_t;
using position_actual_value_t   = int32_t;
using digital_inputs_t          = uint32_t;

PACKED_BEGIN
struct PACKED EC_Ctrl_t
{
    uint16_t    control_word;
    int8_t      modes_of_operation;
    int32_t     target_position;
    uint16_t    touch_probe_function;
};
PACKED_END

PACKED_BEGIN
struct PACKED EC_Stat_t
{
    uint16_t    error_code;
    uint16_t    status_word;
    int8_t      modes_of_operation_display;
    int32_t     position_actual_value;
    uint16_t    touch_probe_status;
    int32_t     touch_probe_pos1_pos_value;
    int32_t     following_error_actual_value;
    uint32_t    digital_inputs;
};
PACKED_END
#endif // ECAT_PDO_MAP_H
